package es.mahulo.battleship.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

@XmlRootElement
@Entity
@Table(name="SHIP_CONFIG")
public class ShipConfig {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name="ID")
	private Long id;
	@Column(name="NAME")
	private String name;
	@Column(name="SIZE")
	private Integer size;
	@Column(name="NUMBER")
	private Integer number;
	@ManyToOne
	@JoinColumn(name="ID_GAME_CONFIG")	
	private GameConfig gameConfig;
	
	public ShipConfig() {
		
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getSize() {
		return size;
	}
	public void setSize(Integer size) {
		this.size = size;
	}
	
	public Integer getNumber() {
		return number;
	}
	public void setNumber(Integer number) {
		this.number = number;
	}
	
	@XmlTransient
	public GameConfig getGameConfig() {
		return gameConfig;
	}
	public void setGameConfig(GameConfig gameConfig) {
		this.gameConfig = gameConfig;
	}
	
	public String toString() {
		return "ShipConfig { Id: " 
				+ id 
				+ " name: " 
				+  name 
				+ " size: " 
				+ size
				+ " number: " 
				+ number 
				+ " }";
	}
	
}
